<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>eqfil</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="ephasor.html" title="ephasor" />
    <link rel="next" href="evalstr.html" title="evalstr" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">eqfil</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="ephasor.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="evalstr.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="eqfil"></a>
      <div class="titlepage"></div>
      <a id="Indexeqfil" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">eqfil</span>
        </h2>
        <p>eqfil — 
      Equalizer filter
    </p>
      </div>
      <div class="refsect1">
        <a id="idp101175568"></a>
        <h2>Description</h2>
        <p>
      The opcode eqfil is a 2nd order tunable equalisation filter based on Regalia and Mitra
      design ("Tunable Digital Frequency Response Equalization Filters", IEEE Trans.
      on Ac., Sp. and Sig Proc., 35 (1), 1987). It provides a peak/notch filter for
      building parametric/graphic equalisers.
    </p>
        <p>
      The amplitude response for this filter will be flat (=1) for <span class="emphasis"><em>kgain</em></span>=1. With <span class="emphasis"><em>kgain</em></span> bigger than 1, there
      will be a peak at the centre frequency, whose width is given by the <span class="emphasis"><em>kbw</em></span> parameter, but 
      outside this band, the response will tend towards 1. Conversely, if <span class="emphasis"><em>kgain</em></span> is smaller than 1, a notch will
      be created around the CF.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp101239840"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">asig <span class="command"><strong>eqfil</strong></span> ain, kcf, kbw, kgain[, istor]</pre>
      </div>
      <div class="refsect1">
        <a id="idp101242064"></a>
        <h2>Initialization</h2>
        <p>
        <span class="emphasis"><em>istor</em></span> --initial disposition of internal data space. Since 
        filtering incorporates a feedback loop of previous output, 
        the initial status of the storage space used is significant. 
        A zero value will clear the space; a non-zero value will allow 
        previous information to remain. The default value is 0.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp101244016"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>asig</em></span> -- filtered output signal.
    </p>
        <p>
      <span class="emphasis"><em>ain</em></span> -- input signal.
    </p>
        <p>
      <span class="emphasis"><em>kcf</em></span> -- filter centre frequency.
    </p>
        <p>
      <span class="emphasis"><em>kbw</em></span> -- peak/notch bandwidth (Hz). 
    </p>
        <p>
      <span class="emphasis"><em>kgain</em></span> -- peak/notch gain. 
    </p>
      </div>
      <div class="refsect1">
        <a id="idp101248944"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the eqfil opcode. It uses the file <a class="ulink" href="examples/eqfil.csd" target="_top"><em class="citetitle">eqfil.csd</em></a>.
            </p>
        <div class="example">
          <a id="idp101250800"></a>
          <p class="title">
            <strong>Example 226. Example of the eqfil opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac     <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o eqfil.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span> <span class="op">=</span> 1

<span class="oblock">instr</span> 1

kcf	<span class="op">=</span> p4
kfe	<span class="opc">expseg</span>	10, p3<span class="op">*</span>0.9, 1800, p3<span class="op">*</span>0.1, 175
kenv	<span class="opc">linen</span>	.03, 0.05, p3, 0.05 <span class="comment">;low amplitude is needed to avoid clipping</span>
asig	<span class="opc">buzz</span>	kenv, kfe, <span class="ohdr">sr</span><span class="op">/</span>(2<span class="op">*</span>kfe), 1
afil	<span class="opc">eqfil</span>	asig, kcf, 200, 10
	<span class="opc">outs</span>	afil<span class="op">*</span>20, afil<span class="op">*</span>20

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="comment">; a sine wave.</span>
<span class="stamnt">f</span> 1 0 16384 10 1

<span class="stamnt">i</span> 1 0 10 200	<span class="comment">;filter centre freq=200</span>
<span class="stamnt">i</span> 1 + 10 1500	<span class="comment">;filter centre freq=1500</span>
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp101255088"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Victor Lazzarini</td>
          </tr>
          <tr>
            <td>April 2007</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in version 5.06</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="ephasor.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="evalstr.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">ephasor </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> evalstr</td>
        </tr>
      </table>
    </div>
  </body>
</html>
